﻿
namespace Indeco.G24.Windows.Forms
{
	/// <summary>
	/// abstract NguoiDung typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class NguoiDungDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<NguoiDungDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.NguoiDung _currentNguoiDung = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxNguoiDungDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxNguoiDungErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxNguoiDungBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the IDNguoiDung property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDNguoiDungDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TenSuDung property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTenSuDungDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the MatKhau property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMatKhauDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ChungThuc property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxChungThucDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the MaKichHoat property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMaKichHoatDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the KichHoat property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxKichHoatDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the CamHoatDong property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxCamHoatDongDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Xoa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxXoaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Ten property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTenDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Ho property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxHoDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Email property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxEmailDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NgaySinh property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNgaySinhDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DiaChi property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDiaChiDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the MoTa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMoTaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the HinhMinhHoa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxHinhMinhHoaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DienThoai property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDienThoaiDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Mobile property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMobileDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the MSN property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMSNDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Yahoo property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxYahooDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Skype property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSkypeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the IP property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIPDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemTruyCap property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemTruyCapDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemThoat property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemThoatDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemCapNhat property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemCapNhatDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemChinhSua property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemChinhSuaDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.NguoiDung> _NguoiDungList;
				
		/// <summary> 
		/// The list of NguoiDung to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.NguoiDung> NguoiDungList
		{
			get {return this._NguoiDungList;}
			set
			{
				this._NguoiDungList = value;
				this.uxNguoiDungBindingSource.DataSource = null;
				this.uxNguoiDungBindingSource.DataSource = value;
				this.uxNguoiDungDataGridView.DataSource = null;
				this.uxNguoiDungDataGridView.DataSource = this.uxNguoiDungBindingSource;				
				//this.uxNguoiDungBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxNguoiDungBindingSource_ListChanged);
				this.uxNguoiDungBindingSource.CurrentItemChanged += new System.EventHandler(OnNguoiDungBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnNguoiDungBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentNguoiDung = uxNguoiDungBindingSource.Current as Entities.NguoiDung;
			
			if (_currentNguoiDung != null)
			{
				_currentNguoiDung.Validate();
			}
			//_NguoiDung.Validate();
			OnCurrentEntityChanged();
		}

		//void uxNguoiDungBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.NguoiDung"/> instance.
		/// </summary>
		public Entities.NguoiDung SelectedNguoiDung
		{
			get {return this._currentNguoiDung;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxNguoiDungDataGridView.VirtualMode;}
			set
			{
				this.uxNguoiDungDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxNguoiDungDataGridView.AllowUserToAddRows;}
			set {this.uxNguoiDungDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxNguoiDungDataGridView.AllowUserToDeleteRows;}
			set {this.uxNguoiDungDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxNguoiDungDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxNguoiDungDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="NguoiDungDataGridViewBase"/> class.
		/// </summary>
		public NguoiDungDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxNguoiDungDataGridView = new System.Windows.Forms.DataGridView();
			this.uxNguoiDungBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxNguoiDungErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDNguoiDungDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTenSuDungDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMatKhauDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxChungThucDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxMaKichHoatDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKichHoatDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxCamHoatDongDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxXoaDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxTenDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxHoDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxEmailDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNgaySinhDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDiaChiDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMoTaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxHinhMinhHoaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDienThoaiDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMobileDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMSNDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxYahooDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSkypeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIPDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemTruyCapDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemThoatDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemCapNhatDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemChinhSuaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			((System.ComponentModel.ISupportInitialize)(this.uxNguoiDungDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNguoiDungBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNguoiDungErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxNguoiDungErrorProvider
			// 
			this.uxNguoiDungErrorProvider.ContainerControl = this;
			this.uxNguoiDungErrorProvider.DataSource = this.uxNguoiDungBindingSource;						
			// 
			// uxNguoiDungDataGridView
			// 
			this.uxNguoiDungDataGridView.AutoGenerateColumns = false;
			this.uxNguoiDungDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxNguoiDungDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDNguoiDungDataGridViewColumn,
		this.uxTenSuDungDataGridViewColumn,
		this.uxMatKhauDataGridViewColumn,
		this.uxChungThucDataGridViewColumn,
		this.uxMaKichHoatDataGridViewColumn,
		this.uxKichHoatDataGridViewColumn,
		this.uxCamHoatDongDataGridViewColumn,
		this.uxXoaDataGridViewColumn,
		this.uxTenDataGridViewColumn,
		this.uxHoDataGridViewColumn,
		this.uxEmailDataGridViewColumn,
		this.uxNgaySinhDataGridViewColumn,
		this.uxDiaChiDataGridViewColumn,
		this.uxMoTaDataGridViewColumn,
		this.uxHinhMinhHoaDataGridViewColumn,
		this.uxDienThoaiDataGridViewColumn,
		this.uxMobileDataGridViewColumn,
		this.uxMSNDataGridViewColumn,
		this.uxYahooDataGridViewColumn,
		this.uxSkypeDataGridViewColumn,
		this.uxIPDataGridViewColumn,
		this.uxThoiDiemTruyCapDataGridViewColumn,
		this.uxThoiDiemThoatDataGridViewColumn,
		this.uxThoiDiemCapNhatDataGridViewColumn,
		this.uxThoiDiemChinhSuaDataGridViewColumn			});
			this.uxNguoiDungDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxNguoiDungDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxNguoiDungDataGridView.Name = "uxNguoiDungDataGridView";
			this.uxNguoiDungDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxNguoiDungDataGridView.TabIndex = 0;	
			this.uxNguoiDungDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxNguoiDungDataGridView.EnableHeadersVisualStyles = false;
			this.uxNguoiDungDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnNguoiDungDataGridViewDataError);
			this.uxNguoiDungDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnNguoiDungDataGridViewCellValueNeeded);
			this.uxNguoiDungDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnNguoiDungDataGridViewCellValuePushed);
			
			//
			// uxIDNguoiDungDataGridViewColumn
			//
			this.uxIDNguoiDungDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDNguoiDungDataGridViewColumn.DataPropertyName = "IDNguoiDung";
			this.uxIDNguoiDungDataGridViewColumn.HeaderText = "IDNguoiDung";
			this.uxIDNguoiDungDataGridViewColumn.Name = "uxIDNguoiDungDataGridViewColumn";
			this.uxIDNguoiDungDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDNguoiDungDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDNguoiDungDataGridViewColumn.ReadOnly = false;		
			//
			// uxTenSuDungDataGridViewColumn
			//
			this.uxTenSuDungDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTenSuDungDataGridViewColumn.DataPropertyName = "TenSuDung";
			this.uxTenSuDungDataGridViewColumn.HeaderText = "TenSuDung";
			this.uxTenSuDungDataGridViewColumn.Name = "uxTenSuDungDataGridViewColumn";
			this.uxTenSuDungDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTenSuDungDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTenSuDungDataGridViewColumn.ReadOnly = false;		
			//
			// uxMatKhauDataGridViewColumn
			//
			this.uxMatKhauDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMatKhauDataGridViewColumn.DataPropertyName = "MatKhau";
			this.uxMatKhauDataGridViewColumn.HeaderText = "MatKhau";
			this.uxMatKhauDataGridViewColumn.Name = "uxMatKhauDataGridViewColumn";
			this.uxMatKhauDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMatKhauDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMatKhauDataGridViewColumn.ReadOnly = false;		
			//
			// uxChungThucDataGridViewColumn
			//
			this.uxChungThucDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxChungThucDataGridViewColumn.DataPropertyName = "ChungThuc";
			this.uxChungThucDataGridViewColumn.HeaderText = "ChungThuc";
			this.uxChungThucDataGridViewColumn.Name = "uxChungThucDataGridViewColumn";
			this.uxChungThucDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxChungThucDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxChungThucDataGridViewColumn.ReadOnly = false;		
			//
			// uxMaKichHoatDataGridViewColumn
			//
			this.uxMaKichHoatDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMaKichHoatDataGridViewColumn.DataPropertyName = "MaKichHoat";
			this.uxMaKichHoatDataGridViewColumn.HeaderText = "MaKichHoat";
			this.uxMaKichHoatDataGridViewColumn.Name = "uxMaKichHoatDataGridViewColumn";
			this.uxMaKichHoatDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMaKichHoatDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMaKichHoatDataGridViewColumn.ReadOnly = false;		
			//
			// uxKichHoatDataGridViewColumn
			//
			this.uxKichHoatDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKichHoatDataGridViewColumn.DataPropertyName = "KichHoat";
			this.uxKichHoatDataGridViewColumn.HeaderText = "KichHoat";
			this.uxKichHoatDataGridViewColumn.Name = "uxKichHoatDataGridViewColumn";
			this.uxKichHoatDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKichHoatDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKichHoatDataGridViewColumn.ReadOnly = false;		
			//
			// uxCamHoatDongDataGridViewColumn
			//
			this.uxCamHoatDongDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxCamHoatDongDataGridViewColumn.DataPropertyName = "CamHoatDong";
			this.uxCamHoatDongDataGridViewColumn.HeaderText = "CamHoatDong";
			this.uxCamHoatDongDataGridViewColumn.Name = "uxCamHoatDongDataGridViewColumn";
			this.uxCamHoatDongDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxCamHoatDongDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxCamHoatDongDataGridViewColumn.ReadOnly = false;		
			//
			// uxXoaDataGridViewColumn
			//
			this.uxXoaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxXoaDataGridViewColumn.DataPropertyName = "Xoa";
			this.uxXoaDataGridViewColumn.HeaderText = "Xoa";
			this.uxXoaDataGridViewColumn.Name = "uxXoaDataGridViewColumn";
			this.uxXoaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxXoaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxXoaDataGridViewColumn.ReadOnly = false;		
			//
			// uxTenDataGridViewColumn
			//
			this.uxTenDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTenDataGridViewColumn.DataPropertyName = "Ten";
			this.uxTenDataGridViewColumn.HeaderText = "Ten";
			this.uxTenDataGridViewColumn.Name = "uxTenDataGridViewColumn";
			this.uxTenDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTenDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTenDataGridViewColumn.ReadOnly = false;		
			//
			// uxHoDataGridViewColumn
			//
			this.uxHoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxHoDataGridViewColumn.DataPropertyName = "Ho";
			this.uxHoDataGridViewColumn.HeaderText = "Ho";
			this.uxHoDataGridViewColumn.Name = "uxHoDataGridViewColumn";
			this.uxHoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxHoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxHoDataGridViewColumn.ReadOnly = false;		
			//
			// uxEmailDataGridViewColumn
			//
			this.uxEmailDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxEmailDataGridViewColumn.DataPropertyName = "Email";
			this.uxEmailDataGridViewColumn.HeaderText = "Email";
			this.uxEmailDataGridViewColumn.Name = "uxEmailDataGridViewColumn";
			this.uxEmailDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxEmailDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxEmailDataGridViewColumn.ReadOnly = false;		
			//
			// uxNgaySinhDataGridViewColumn
			//
			this.uxNgaySinhDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNgaySinhDataGridViewColumn.DataPropertyName = "NgaySinh";
			this.uxNgaySinhDataGridViewColumn.HeaderText = "NgaySinh";
			this.uxNgaySinhDataGridViewColumn.Name = "uxNgaySinhDataGridViewColumn";
			this.uxNgaySinhDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNgaySinhDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNgaySinhDataGridViewColumn.ReadOnly = false;		
			//
			// uxDiaChiDataGridViewColumn
			//
			this.uxDiaChiDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDiaChiDataGridViewColumn.DataPropertyName = "DiaChi";
			this.uxDiaChiDataGridViewColumn.HeaderText = "DiaChi";
			this.uxDiaChiDataGridViewColumn.Name = "uxDiaChiDataGridViewColumn";
			this.uxDiaChiDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDiaChiDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDiaChiDataGridViewColumn.ReadOnly = false;		
			//
			// uxMoTaDataGridViewColumn
			//
			this.uxMoTaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMoTaDataGridViewColumn.DataPropertyName = "MoTa";
			this.uxMoTaDataGridViewColumn.HeaderText = "MoTa";
			this.uxMoTaDataGridViewColumn.Name = "uxMoTaDataGridViewColumn";
			this.uxMoTaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMoTaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMoTaDataGridViewColumn.ReadOnly = false;		
			//
			// uxHinhMinhHoaDataGridViewColumn
			//
			this.uxHinhMinhHoaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxHinhMinhHoaDataGridViewColumn.DataPropertyName = "HinhMinhHoa";
			this.uxHinhMinhHoaDataGridViewColumn.HeaderText = "HinhMinhHoa";
			this.uxHinhMinhHoaDataGridViewColumn.Name = "uxHinhMinhHoaDataGridViewColumn";
			this.uxHinhMinhHoaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxHinhMinhHoaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxHinhMinhHoaDataGridViewColumn.ReadOnly = false;		
			//
			// uxDienThoaiDataGridViewColumn
			//
			this.uxDienThoaiDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDienThoaiDataGridViewColumn.DataPropertyName = "DienThoai";
			this.uxDienThoaiDataGridViewColumn.HeaderText = "DienThoai";
			this.uxDienThoaiDataGridViewColumn.Name = "uxDienThoaiDataGridViewColumn";
			this.uxDienThoaiDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDienThoaiDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDienThoaiDataGridViewColumn.ReadOnly = false;		
			//
			// uxMobileDataGridViewColumn
			//
			this.uxMobileDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMobileDataGridViewColumn.DataPropertyName = "Mobile";
			this.uxMobileDataGridViewColumn.HeaderText = "Mobile";
			this.uxMobileDataGridViewColumn.Name = "uxMobileDataGridViewColumn";
			this.uxMobileDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMobileDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMobileDataGridViewColumn.ReadOnly = false;		
			//
			// uxMSNDataGridViewColumn
			//
			this.uxMSNDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMSNDataGridViewColumn.DataPropertyName = "MSN";
			this.uxMSNDataGridViewColumn.HeaderText = "MSN";
			this.uxMSNDataGridViewColumn.Name = "uxMSNDataGridViewColumn";
			this.uxMSNDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMSNDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMSNDataGridViewColumn.ReadOnly = false;		
			//
			// uxYahooDataGridViewColumn
			//
			this.uxYahooDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxYahooDataGridViewColumn.DataPropertyName = "Yahoo";
			this.uxYahooDataGridViewColumn.HeaderText = "Yahoo";
			this.uxYahooDataGridViewColumn.Name = "uxYahooDataGridViewColumn";
			this.uxYahooDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxYahooDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxYahooDataGridViewColumn.ReadOnly = false;		
			//
			// uxSkypeDataGridViewColumn
			//
			this.uxSkypeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSkypeDataGridViewColumn.DataPropertyName = "Skype";
			this.uxSkypeDataGridViewColumn.HeaderText = "Skype";
			this.uxSkypeDataGridViewColumn.Name = "uxSkypeDataGridViewColumn";
			this.uxSkypeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSkypeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSkypeDataGridViewColumn.ReadOnly = false;		
			//
			// uxIPDataGridViewColumn
			//
			this.uxIPDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIPDataGridViewColumn.DataPropertyName = "IP";
			this.uxIPDataGridViewColumn.HeaderText = "IP";
			this.uxIPDataGridViewColumn.Name = "uxIPDataGridViewColumn";
			this.uxIPDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIPDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIPDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemTruyCapDataGridViewColumn
			//
			this.uxThoiDiemTruyCapDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemTruyCapDataGridViewColumn.DataPropertyName = "ThoiDiemTruyCap";
			this.uxThoiDiemTruyCapDataGridViewColumn.HeaderText = "ThoiDiemTruyCap";
			this.uxThoiDiemTruyCapDataGridViewColumn.Name = "uxThoiDiemTruyCapDataGridViewColumn";
			this.uxThoiDiemTruyCapDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemTruyCapDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemTruyCapDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemThoatDataGridViewColumn
			//
			this.uxThoiDiemThoatDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemThoatDataGridViewColumn.DataPropertyName = "ThoiDiemThoat";
			this.uxThoiDiemThoatDataGridViewColumn.HeaderText = "ThoiDiemThoat";
			this.uxThoiDiemThoatDataGridViewColumn.Name = "uxThoiDiemThoatDataGridViewColumn";
			this.uxThoiDiemThoatDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemThoatDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemThoatDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemCapNhatDataGridViewColumn
			//
			this.uxThoiDiemCapNhatDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemCapNhatDataGridViewColumn.DataPropertyName = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.HeaderText = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.Name = "uxThoiDiemCapNhatDataGridViewColumn";
			this.uxThoiDiemCapNhatDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemCapNhatDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemCapNhatDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemChinhSuaDataGridViewColumn
			//
			this.uxThoiDiemChinhSuaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemChinhSuaDataGridViewColumn.DataPropertyName = "ThoiDiemChinhSua";
			this.uxThoiDiemChinhSuaDataGridViewColumn.HeaderText = "ThoiDiemChinhSua";
			this.uxThoiDiemChinhSuaDataGridViewColumn.Name = "uxThoiDiemChinhSuaDataGridViewColumn";
			this.uxThoiDiemChinhSuaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemChinhSuaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemChinhSuaDataGridViewColumn.ReadOnly = false;		
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxNguoiDungDataGridView);
			this.Name = "NguoiDungDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			((System.ComponentModel.ISupportInitialize)(this.uxNguoiDungErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNguoiDungDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNguoiDungBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				NguoiDungDataGridViewEventArgs args = new NguoiDungDataGridViewEventArgs();
				args.NguoiDung = _currentNguoiDung;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class NguoiDungDataGridViewEventArgs : System.EventArgs
		{
			private Entities.NguoiDung	_NguoiDung;
	
			/// <summary>
			/// the  Entities.NguoiDung instance.
			/// </summary>
			public Entities.NguoiDung NguoiDung
			{
				get { return _NguoiDung; }
				set { _NguoiDung = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxNguoiDungDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnNguoiDungDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxNguoiDungDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnNguoiDungDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxNguoiDungDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDNguoiDungDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].IDNguoiDung;
						break;
					case "uxTenSuDungDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].TenSuDung;
						break;
					case "uxMatKhauDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].MatKhau;
						break;
					case "uxChungThucDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].ChungThuc;
						break;
					case "uxMaKichHoatDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].MaKichHoat;
						break;
					case "uxKichHoatDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].KichHoat;
						break;
					case "uxCamHoatDongDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].CamHoatDong;
						break;
					case "uxXoaDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].Xoa;
						break;
					case "uxTenDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].Ten;
						break;
					case "uxHoDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].Ho;
						break;
					case "uxEmailDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].Email;
						break;
					case "uxNgaySinhDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].NgaySinh;
						break;
					case "uxDiaChiDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].DiaChi;
						break;
					case "uxMoTaDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].MoTa;
						break;
					case "uxHinhMinhHoaDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].HinhMinhHoa;
						break;
					case "uxDienThoaiDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].DienThoai;
						break;
					case "uxMobileDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].Mobile;
						break;
					case "uxMSNDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].MSN;
						break;
					case "uxYahooDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].Yahoo;
						break;
					case "uxSkypeDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].Skype;
						break;
					case "uxIPDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].IP;
						break;
					case "uxThoiDiemTruyCapDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].ThoiDiemTruyCap;
						break;
					case "uxThoiDiemThoatDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].ThoiDiemThoat;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].ThoiDiemCapNhat;
						break;
					case "uxThoiDiemChinhSuaDataGridViewColumn":
						e.Value = NguoiDungList[e.RowIndex].ThoiDiemChinhSua;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxNguoiDungDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnNguoiDungDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxNguoiDungDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDNguoiDungDataGridViewColumn":
						NguoiDungList[e.RowIndex].IDNguoiDung = (System.Guid)e.Value;
						break;
					case "uxTenSuDungDataGridViewColumn":
						NguoiDungList[e.RowIndex].TenSuDung = (System.String)e.Value;
						break;
					case "uxMatKhauDataGridViewColumn":
						NguoiDungList[e.RowIndex].MatKhau = (System.String)e.Value;
						break;
					case "uxChungThucDataGridViewColumn":
						NguoiDungList[e.RowIndex].ChungThuc = (System.Boolean)e.Value;
						break;
					case "uxMaKichHoatDataGridViewColumn":
						NguoiDungList[e.RowIndex].MaKichHoat = (System.String)e.Value;
						break;
					case "uxKichHoatDataGridViewColumn":
						NguoiDungList[e.RowIndex].KichHoat = (System.Boolean)e.Value;
						break;
					case "uxCamHoatDongDataGridViewColumn":
						NguoiDungList[e.RowIndex].CamHoatDong = (System.Boolean)e.Value;
						break;
					case "uxXoaDataGridViewColumn":
						NguoiDungList[e.RowIndex].Xoa = (System.Boolean)e.Value;
						break;
					case "uxTenDataGridViewColumn":
						NguoiDungList[e.RowIndex].Ten = (System.String)e.Value;
						break;
					case "uxHoDataGridViewColumn":
						NguoiDungList[e.RowIndex].Ho = (System.String)e.Value;
						break;
					case "uxEmailDataGridViewColumn":
						NguoiDungList[e.RowIndex].Email = (System.String)e.Value;
						break;
					case "uxNgaySinhDataGridViewColumn":
						NguoiDungList[e.RowIndex].NgaySinh = (System.DateTime?)e.Value;
						break;
					case "uxDiaChiDataGridViewColumn":
						NguoiDungList[e.RowIndex].DiaChi = (System.String)e.Value;
						break;
					case "uxMoTaDataGridViewColumn":
						NguoiDungList[e.RowIndex].MoTa = (System.String)e.Value;
						break;
					case "uxHinhMinhHoaDataGridViewColumn":
						NguoiDungList[e.RowIndex].HinhMinhHoa = (System.String)e.Value;
						break;
					case "uxDienThoaiDataGridViewColumn":
						NguoiDungList[e.RowIndex].DienThoai = (System.String)e.Value;
						break;
					case "uxMobileDataGridViewColumn":
						NguoiDungList[e.RowIndex].Mobile = (System.String)e.Value;
						break;
					case "uxMSNDataGridViewColumn":
						NguoiDungList[e.RowIndex].MSN = (System.String)e.Value;
						break;
					case "uxYahooDataGridViewColumn":
						NguoiDungList[e.RowIndex].Yahoo = (System.String)e.Value;
						break;
					case "uxSkypeDataGridViewColumn":
						NguoiDungList[e.RowIndex].Skype = (System.String)e.Value;
						break;
					case "uxIPDataGridViewColumn":
						NguoiDungList[e.RowIndex].IP = (System.String)e.Value;
						break;
					case "uxThoiDiemTruyCapDataGridViewColumn":
						NguoiDungList[e.RowIndex].ThoiDiemTruyCap = (System.DateTime)e.Value;
						break;
					case "uxThoiDiemThoatDataGridViewColumn":
						NguoiDungList[e.RowIndex].ThoiDiemThoat = (System.DateTime)e.Value;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						NguoiDungList[e.RowIndex].ThoiDiemCapNhat = (System.DateTime)e.Value;
						break;
					case "uxThoiDiemChinhSuaDataGridViewColumn":
						NguoiDungList[e.RowIndex].ThoiDiemChinhSua = (System.DateTime)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
